package com.focusai.efairy.ui.adapter.warn;

import android.content.Context;

import com.focusai.efairy.R;
import com.focusai.efairy.model.project.CompanyCodeItem;
import com.focusai.efairy.model.project.UsageCodeItem;
import com.focusai.efairy.model.project.VersionItem;
import com.focusai.efairy.ui.adapter.base.BaseRecyclerAdapter;
import com.focusai.efairy.ui.adapter.base.BaseRecyclerViewHolder;

/**
 * Created by lifeng on 2017/7/2
 */

public class UpgradeAdapter extends BaseRecyclerAdapter<Object> {
    public UpgradeAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.item_upgrade_info;
    }

    @Override
    protected void onBindBaseRecyclerViewHolder(BaseRecyclerViewHolder holder, int position) {


        Object o = mList.get(position);
        if(o instanceof VersionItem){//版本信息
            VersionItem item = (VersionItem)o;
            holder.setText(R.id.tv_text, item.getEfairydeviceversion_version()+"");
            holder.setText(R.id.tv_text2, item.getEfairydeviceversion_add_time());
            holder.setText(R.id.tv_text3, item.getEfairydeviceversion_description());
        }else if(o instanceof UsageCodeItem){//用途信息
            UsageCodeItem item = (UsageCodeItem)o;
            holder.setText(R.id.tv_text, item.getEfairydeviceusagecode_id()+"");
            holder.setText(R.id.tv_text2, item.getEfairydeviceusagecode_add_time());
            holder.setText(R.id.tv_text3, item.getEfairydeviceusagecode_name());
        }else if(o instanceof CompanyCodeItem){//企业信息
            CompanyCodeItem item = (CompanyCodeItem)o;
            holder.setText(R.id.tv_text, item.getEfairydevicecompanycode_id()+"");
            holder.setText(R.id.tv_text2, item.getEfairydevicecompanycode_add_time());
            holder.setText(R.id.tv_text3, item.getEfairydevicecompanycode_name());
        }
    }

}
